before_all do |lane|
  ENV["SUPPLY_METADATA_PATH"] = "./fastlane/metadata/playstore"
end

desc "Download iOS screenshots"
lane :download_ios_screenshots do
  user_name = ENV["APPLE_USER_NAME"]
  bundle_id = ENV["PHOTOS_APP_BUNDLE_ID"]
  sh("fastlane deliver download_screenshots -w './metadata/ios/Screenshots' -u '#{user_name}' -a '#{bundle_id}' --use_live_version true --metadata_path './metadata/ios'")
end



desc "Download Android metadata"
lane :download_android_metadata do
  puts "Loading Appfile from path: #{File.expand_path('../Appfile', __FILE__)}"
  package_name = ENV["PHOTOS_PKG_NAME"]
  key_path = ENV["PHOTOS_PLAYSTORE_JSON_KEY_PATH"]

  sh("fastlane supply init --metadata_path='./fastlane/metadata/playstore'
  --json_key='#{key_path}' --package_name='#{package_name}'")


#   UI.success("Android metadata downloaded to #{ENV["SUPPLY_METADATA_PATH"]}")
end
